﻿using System.Windows;
using System.Windows.Controls;
using SoftSource.Common;
using SoftSource.Timecard.ViewModelInterfaces;

namespace SoftSource.Timecard.Views
{
    public sealed partial class ManagementView : UserControl
    {
        public ManagementView()
        {
            InitializeComponent();

            Loaded += new RoutedEventHandler(ManagementView_Loaded);
        }

        #region Events

        void ManagementView_Loaded(object sender, RoutedEventArgs e)
        {
            this.InitializeManagementViews();
        }

        #endregion Events

        #region Methods

        private void InitializeManagementViews()
        {
            this.CategoriesContent.Content = this.ViewModel.ManageCategories.TryInvoke();
            this.CustomersContent.Content = this.ViewModel.ManageCustomers.TryInvoke();
            this.MilestonesContent.Content = this.ViewModel.ManageMilestones.TryInvoke();
            this.ProjectsContent.Content = this.ViewModel.ManageProjects.TryInvoke();
            this.UsersContent.Content = this.ViewModel.ManageUsers.TryInvoke();
            this.InvoicingContent.Content = this.ViewModel.ManageInvoices.TryInvoke();
            this.TimecardsContent.Content = this.ViewModel.ManageTimecards.TryInvoke();
        }

        #endregion Methods

        #region IView<IManagementViewModelConsume> Members

        public IManagementViewModelConsume ViewModel
        {
            get { return this.DataContext as IManagementViewModelConsume; }
        }

        #endregion
    }
}
